<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('单位项目查询列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li class="select-time">
                                <label>凭证日期：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPzrq]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPzrq]"/>
                            </li>
                            <li style="width:265px">
                                <label>单位编码：</label> 
				                    <div class="input-group"> 
				                        <input class="form-control" type="text" ondblclick="selectHsdwTree()" id="dwbm" name="dwbm">
				                        <span class="input-group-addon"><i class="fa fa-search" onclick="selectHsdwTree()"></i></span>
				                    </div> 
                            </li>   
                            <li style="width:265px">
                                <label>科目代码：</label> 
	                                 <div class="input-group">
		                                <input class="form-control" type="text" ondblclick="selectKmdmTree()" id="kmdm"  name="kmdm">
		                        		<span class="input-group-addon"><i class="fa fa-search" onclick="selectKmdmTree()"></i></span>
	                        		 </div> 
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:dwxmcx:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/dwxmcx";
        
        /*会计科目-新增-选择父部门树*/
        function selectKmdmTree() {
            var options = {
                title: '会计科目选择',
                width: "380",
                url: ctx + "system/kmdm/selectKmdmTree/",
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
               var body = layer.getChildFrame('body', index);
               $("#kmdm").val(body.find('#treeId').val());
               //$("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }
        
        /*核算单位-新增-选择父部门树*/
        function selectHsdwTree() {
            var options = {
                title: '核算单位选择',
                width: "380",
                url: ctx + "system/hsdw/selectHsdwTree/",
                callBack: dohsdwSubmit
            };
            $.modal.openOptions(options);
        }

        function dohsdwSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#dwbm").val(body.find('#treeId').val());
               layer.close(index);
        }

        $(function() {
            var options = {
                url: prefix + "/list", 
                exportUrl: prefix + "/export",
                modalName: "单位项目查询",
                firstLoad: false,
                columns: [{
                    checkbox: true
                },{
                    field: 'pzrq',
                    title: '凭证日期'
                },
                {
                    field: 'pzbh',
                    title: '凭证编号'
                },
                {
                    field: 'kmdm',
                    title: '科目代码'
                },
                {
                    field: 'kmmc',
                    title: '科目名称'
                },
                {
                    field: 'pzzy',
                    title: '凭证摘要'
                },
                {
                    field: 'zy',
                    title: '摘要'
                },
                {
                    field: 'dwbm',
                    title: '单位编码'
                },
                {
                    field: 'dwmc',
                    title: '单位名称'
                }, 
                {
                    field: 'pjh',
                    title: '票据号'
                },
                {
                    field: 'xmbm',
                    title: '项目编码'
                },
                {
                    field: 'xmmc',
                    title: '项目名称'
                },
                {
                    field: 'dfje',
                    title: '贷方金额'
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>